import App from './App'
import uView from "uview-ui";
Vue.use(uView);

// 引入主包依赖
import TencentCloudChat  from "@tencentcloud/chat";
import TUICore from "@tencentcloud/tui-core";

import tim from './commen/tim/tim.js'
import commen from './commen/commen.js'
import TIM from 'tim-js-sdk/tim-js-friendship.js'
import store from './store/index.js'

Vue.config.productionTip = false  
Vue.prototype.tim = tim.tim  			//tim sdk 引入后生成的tim服务
Vue.prototype.$TIM = TIM				//tim 的状态/事件 常量
Vue.prototype.$store = store
Vue.prototype.$commen = commen

/* start main.js通用引入部分 */
import * as Config from '@/common/config.js' 
import * as Common from '@/common/common.js' 
import * as Db from '@/common/db.js'
import * as Api from '@/common/Api.js'
import share from 'components/share.js'
Vue.mixin(share);
Vue.prototype.$config = Config;
Vue.prototype.$common = Common;
Vue.prototype.$db = Db;
Vue.prototype.$api = Api;

import common from './common/noMultipleClicks.js'
Vue.prototype.$noMultipleClicks = common.noMultipleClicks;

import dLoading from '@/components/d-loading/d-loading.vue'
Vue.component('dLoading',dLoading)

Vue.prototype.uploadImgUrl= "https://api.dreamyuewen.com/api/common/upload"

Vue.prototype.goToxie= function(){
	uni.navigateTo({
		url: '/pages/user/abount_dea?id=3' 
	})
}

Vue.prototype.goToOtherxie= function(id){
	uni.navigateTo({
		url: '/pages/user/abount_dea?id=' + id 
	})
}

Vue.prototype.$back= function(){
	uni.navigateBack()
}

// 注册全局过滤器
import * as filters from '@/common/filters.js'
Object.keys(filters).forEach(key => {
    Vue.filter(key, filters[key])
})

// Db.set('auth','78535c7d-ffe5-45c8-87da-3bc05c35bd38');
Common.isLogin()
Common.getConfig()

//go
Vue.prototype.$go = (path) => {
	if(!Db.get('auth')){
		uni.navigateTo({
			url: '/pages/login/login'
		})
		return
	}
	
	uni.navigateTo({
		url: path
	})
}

Vue.prototype.$goLogin = (path) => {	
	uni.navigateTo({
		url: path
	})
}
Vue.prototype.$to = (path) => {
	console.log("跳转到", path)
	uni.reLaunch({
		url: path
	})
}
// #ifndef VUE3
import Vue from 'vue' 
import './uni.promisify.adaptor'
import VueCompositionAPI from "@vue/composition-api";
Vue.use(VueCompositionAPI);


Vue.config.productionTip = false
App.mpType = 'app'


const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif